home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / StatusMonitor / UDocumentSecondStomach.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  3.5 KB  |  141 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        UDocumentSecondStomach.h
  3.  
  4.     Contains:    *** put contents here ***
  5.  
  6.     Written by:    Steve Datnow
  7.  
  8.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          8/18/93    SLD        Add Disconnect Method
  13.         1/7/92      SLD        Created
  14.  
  15.     To Do:
  16. */
  17.  
  18.  
  19. #ifndef __UDOCUMENTSecondStomach__
  20. #define __UDOCUMENTSecondStomach__
  21.  
  22. #ifndef __UViewStatusInfo__
  23. #include "UViewStatusInfo.h"
  24. #endif
  25.  
  26. #ifndef __UFILEBASEDDOCUMENT__
  27. #include <UFileBasedDocument.h>
  28. #endif
  29.  
  30. //----------------------------------------------------------------------------------------
  31. // Constants
  32. //----------------------------------------------------------------------------------------
  33.  
  34. // Commands
  35. // const CommandNumber cCommandHandledByDocument = 401;
  36.  
  37. // Files
  38. const OSType kFileType = 'SF01';    // File-type code used for document files 
  39.  
  40. const  kViewsToGreyWhenDisconnected = 6001;
  41. //----------------------------------------------------------------------------------------
  42. // TDocumentSecondStomach
  43. //----------------------------------------------------------------------------------------
  44. class TTimerHandler;
  45.  
  46. class TDocumentSecondStomach: public TFileBasedDocument
  47. {
  48. public:
  49.         
  50.     // Construction/Destruction
  51.     virtual pascal void Initialize(); // Override
  52.     
  53.     virtual pascal void  IDocumentSecondStomach(TFile* itsFile, OSType itsCreator);
  54.     virtual pascal void  DoInitialState(); // Override
  55.     virtual pascal void  FreeData(); // Override
  56.     virtual pascal void  Free(); // Override
  57.             
  58.     // Views
  59.     virtual pascal void  DoMakeViews(Boolean forPrinting); // Override
  60.  
  61.     // Commands
  62.     virtual pascal void  DoSetupMenus(); // Override
  63.     virtual pascal void  DoMenuCommand(CommandNumber aCommandNumber); // Override
  64.  
  65.     // Saving and Restoring
  66.     virtual pascal void  DoNeedDiskSpace(TFile* ,
  67.                                         long& dataForkBytes,
  68.                                         long& rsrcForkBytes); // Override
  69.     virtual pascal void  DoRead(TFile* aFile,
  70.                                 Boolean forPrinting); // Override
  71.     virtual pascal void  DoWrite(TFile* aFile,
  72.                                 Boolean makingCopy); // Override
  73.                                 
  74.     virtual pascal long  GetSessionID();
  75.     
  76.     virtual pascal void HandleStatusInfo(TAppleEvent* theMessage);
  77.     
  78.     virtual pascal Boolean DoIdle(IdlePhase phase);
  79.     
  80.     virtual pascal void ResetTimer();
  81.     virtual pascal Boolean TimerExpired();
  82.     
  83.     pascal OSErr EstablishSession();
  84.     pascal void SendItemsToBeLogged();
  85.     
  86.     pascal void MonitoringChange(Boolean stopMonitoring);
  87.  
  88.     pascal void SetStatus(CStr255 message);
  89.     pascal void BlinkStatus();
  90.     pascal void AddToLog(CStr255 message);
  91.     
  92.     pascal void SendAliveMessage();
  93.     
  94.     pascal void SendButtonMessage(long buttonId);
  95.     pascal void SendConfigMessage(TView* theView);
  96.  
  97.     pascal void GetConfigValue(TView* theView);
  98.  
  99.     pascal void Disconnect();
  100.  
  101. public:
  102.     Boolean fDisconnected;
  103. private:
  104.     static long fUniqueSessionID;
  105.     long fDocSessionID;
  106.     TStatusItemList* fStatusList;
  107.     AEAddressDesc fTargetAddress;
  108.     unsigned long fHeartBeat;
  109.     //long    fSendAliveCounter;
  110.     TDynamicArray* fItemsToBeMonitored;
  111.     TTimerHandler* fTimerHandler;
  112.     TViewlogStatusInfo* fLog;
  113.     TViewMonitorStatus* fStatus;
  114.     Boolean fReOpening;
  115.     VRect fWinFrame;
  116.     TargetID fTargetID;
  117. };
  118.  
  119. class TDialogViewConfig : public TDialogView
  120. {
  121.     public:
  122.         virtual pascal void DoEvent(EventNumber eventNumber, TEventHandler* source,
  123.                                     TEvent* event);
  124.                                     
  125.         virtual pascal void TDialogViewConfig::Open(void);
  126.  
  127. };
  128.  
  129.  
  130. class TTimerHandler : public TEventHandler
  131. {
  132.     public:
  133.         virtual pascal void ITimerHandler(TDocumentSecondStomach* parentDoc);
  134.         virtual pascal Boolean DoIdle(IdlePhase);
  135.     private:
  136.         TDocumentSecondStomach* fParentDoc;
  137.         unsigned long fBaseTimer;
  138. };
  139.  
  140. #endif
  141.